﻿@using MvcPaging;
@model IPagedList<Entidades.Seguridad.Formulario>

@{
    ViewBag.Title = "Gestion de Formularios";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="../../Content/themes/bootstrap.extra.table.css" rel="stylesheet" />
<div id="ajaxReponse">

<h1>Gestion <small>de Formularios</small></h1>

    @if (ViewBag.PermisoCrear)
    {
        <p> @Html.ActionLink("Crear Nuevo Formulario", "Create", null, new { @class = "btn" }) </p>
    }
    else
    {
        <p> <input type="submit" class="btn disabled" value="Crear Nuevo Formulario" /> </p>
    }
    

@{Html.RenderPartial("SearchBoxItems", "Formularios");}    

<div class="pagingContainer">
    @Html.Pager(Model.PageSize, Model.PageNumber, Model.TotalItemCount)
</div>
    

<table class="zebra-striped">
    <thead>
        <th>
            IdFormulario
        </th>
        <th>
            Nombre
        </th>
        <th>
            Descripcion
        </th>
        <th>
            Acciones
        </th>
    </thead>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.IdFormulario)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Nombre)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Descripcion)
        </td>
        <td>
            @if (ViewBag.PermisoEditar)
            {
                @Html.ActionLink("Editar", "Edit", new { IdFormulario = item.IdFormulario }, new { @class = "btn primary" }) 
            }
            else
            {
                <input type="submit" class="btn actions primary disabled" value="Editar" />
            }

            @if (ViewBag.PermisoDelete)
            {
                @Html.ActionLink("Eliminar", "Delete", new { IdFormulario = item.IdFormulario }, new { @class = "btn danger" }) 
            }
            else
            {
                <input type="submit" class="btn danger disabled" value="Eliminar" />
            }
        </td>
    </tr>
}

</table>
</div>
